package com.wz.project.sap.INSPECT2UNRESTRICTED.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.project.sap.INSPECT2UNRESTRICTED.domain.ZflWmsInspect2unrestricted;
import com.wz.project.sap.INSPECT2UNRESTRICTED.service.IZflWmsInspect2unrestrictedService;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * 质检转非限制Controller
 * 
 * @author wz
 * @date 2022-09-14
 */
@Controller
@RequestMapping("/system/INSPECT2UNRESTRICTED")
public class ZflWmsInspect2unrestrictedController extends BaseController
{
    private String prefix = "system/INSPECT2UNRESTRICTED";

    @Autowired
    private IZflWmsInspect2unrestrictedService zflWmsInspect2unrestrictedService;

    @RequiresPermissions("system:INSPECT2UNRESTRICTED:view")
    @GetMapping()
    public String INSPECT2UNRESTRICTED()
    {
        return prefix + "/INSPECT2UNRESTRICTED";
    }

    /**
     * 查询质检转非限制列表
     */
//    @RequiresPermissions("system:INSPECT2UNRESTRICTED:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ZflWmsInspect2unrestricted zflWmsInspect2unrestricted)
    {
        startPage();
        List<ZflWmsInspect2unrestricted> list = zflWmsInspect2unrestrictedService.selectZflWmsInspect2unrestrictedList(zflWmsInspect2unrestricted);
        return getDataTable(list);
    }

    /**
     * 导出质检转非限制列表
     */
//    @RequiresPermissions("system:INSPECT2UNRESTRICTED:export")
    @Log(title = "质检转非限制", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ZflWmsInspect2unrestricted zflWmsInspect2unrestricted)
    {
        List<ZflWmsInspect2unrestricted> list = zflWmsInspect2unrestrictedService.selectZflWmsInspect2unrestrictedList(zflWmsInspect2unrestricted);
        ExcelUtil<ZflWmsInspect2unrestricted> util = new ExcelUtil<ZflWmsInspect2unrestricted>(ZflWmsInspect2unrestricted.class);
        return util.exportExcel(list, "INSPECT2UNRESTRICTED");
    }

    /**
     * 新增质检转非限制
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存质检转非限制
     */
    @RequiresPermissions("system:INSPECT2UNRESTRICTED:add")
    @Log(title = "质检转非限制", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ZflWmsInspect2unrestricted zflWmsInspect2unrestricted)
    {
        return toAjax(zflWmsInspect2unrestrictedService.insertZflWmsInspect2unrestricted(zflWmsInspect2unrestricted));
    }

    /**
     * 修改质检转非限制
     */
    @GetMapping("/edit/{ZEILE}")
    public String edit(@PathVariable("ZEILE") String ZEILE, ModelMap mmap)
    {
        ZflWmsInspect2unrestricted zflWmsInspect2unrestricted = zflWmsInspect2unrestrictedService.selectZflWmsInspect2unrestrictedById(ZEILE);
        mmap.put("zflWmsInspect2unrestricted", zflWmsInspect2unrestricted);
        return prefix + "/edit";
    }

    /**
     * 修改保存质检转非限制
     */
    @RequiresPermissions("system:INSPECT2UNRESTRICTED:edit")
    @Log(title = "质检转非限制", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ZflWmsInspect2unrestricted zflWmsInspect2unrestricted)
    {
        return toAjax(zflWmsInspect2unrestrictedService.updateZflWmsInspect2unrestricted(zflWmsInspect2unrestricted));
    }

    /**
     * 删除质检转非限制
     */
    @RequiresPermissions("system:INSPECT2UNRESTRICTED:remove")
    @Log(title = "质检转非限制", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(zflWmsInspect2unrestrictedService.deleteZflWmsInspect2unrestrictedByIds(ids));
    }
}
